<?php if (!defined('THINK_PATH')) exit();?><table class="table table-bordered">
    <thead>
    <tr>
        <th width="8%">拍卖单号</th>
        <th width="15%">车型</th>
        <th width="6%">所在地</th>
        <?php if($params['status']==0 ||$params['status']==1 || $params['status']==2 ):?>
        <th width="8%">车商联系人</th>
        <th width="10%">联系人电话</th>
        <?php endif;?>
        <th width="8%">拍卖最高价</th>
        <th width="7%">保留价</th>
        <?php if($params['auth'] && $params['status']==3):?>
        <th width="8%">渠道来源</th>
        <?php endif;?>
        <?php if($params['auth'] && $params['status']!=0 && $params['status']!=5):?>
        <th width="6%">操作人</th>
        <?php endif;?>
        <?php if($params['status']==1):?>
        <th width="12%">下次跟踪时间</th>
        <?php elseif($params['status']==3 || $params['status']==5):?>
        <th width="10%">确认时间</th>
        <?php endif;?>
        <th width="6%">确认类型</th>
        <th width="4%">操作</th>
    </tr>
    </thead>
    <tbody>
    <?php if(is_array($list)): $k = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($k % 2 );++$k;?><tr>
            <td style="text-align: center;"><?php echo ($list["order_no"]); ?></td>
            <td>
                <a href="<?php echo U('Car/report',['car_id'=>$list['car_id']]);?>" target="_blank"
                   class="cheText"><?php echo ($list["model"]); ?></a>
            </td>
            <td style="text-align: center;"><?php echo ($list["location_area"]); ?></td>
            <?php if($params['status']==0 ||$params['status']==1 || $params['status']==2 ):?>
            <td style="text-align: center;"><?php echo ($list["dealer_contact_person"]); ?></td>
            <?php if($_GET['status']== 0): ?><td style="text-align: center;"><?php echo ($list["dealer_phone_has_star"]); ?></td>
                <?php else: ?>
                <td style="text-align: center;"><?php echo ($list["dealer_contact_mobile"]); ?></td><?php endif; ?>
            <?php endif;?>
            <td style="text-align: center;"><?php echo ($list["best_price"]); ?>元</td>
            <td style="text-align: center;"><?php echo ($list["reserve_price"]); ?>元</td>
            <?php if($params['auth'] && $params['status']==3):?>
            <td style="text-align: center;">
                <?php if($list["comefrom"] != ''): if(empty($list['comefrom_url'])):?>
                    <?php echo $show_from[$list['comefrom']];?>
                    <?php else: ?>
                    <a href="<?php echo ($list["comefrom_url"]); ?>" target="_blank" rel="noreferrer"><?php echo $show_from[$list['comefrom']];?></a>
                    <?php endif;?>
                    <?php else: ?>
                    未知<?php endif; ?>
            </td>
            <?php endif;?>
            <?php if($params['auth'] && $params['status']!=0 && $params['status']!=5):?>
            <td style="text-align: center;"><?php echo ($list["platform_service"]); ?></td>
            <?php endif;?>
            <?php if($params['status']==1):?>
            <td style="text-align: center;"><?php echo ($list["next_trace_time"]); ?></td>
            <?php elseif($params['status']==3) :?>
            <td style="text-align: center;"><?php echo ($list["platform_confirm_time"]); ?></td>
            <?php elseif($params['status'] == 5): ?>
            <td><?php echo ($list["platform_conform_failed_time"]); ?></td>
            <?php endif;?>
            <td><?php echo ($list["platform_confirm_type_name"]); ?></td>
            <td>
                <?php if($list[status] == 5 AND $list[confirm_type] == 1): if($_GET['status']== 0): ?><a onclick="is_assigned('<?php echo ($list["order_id"]); ?>');" href="javascript:;">确认</a>
                        <?php else: ?>
                        <?php if($params['emp_id'] == $list['platform_confirm_service_id']): if($params["fenpei_auth"] == true): ?><a href="<?php echo U('AuOrder/platform_confirm_detail',['status'=>$params['status'],'order_id'=>$list['order_id']]);?>">确认</a>
                                <a href="javascript:;" onclick="fenpei('<?php echo ($list["order_id"]); ?>');">分配</a>
                                <?php else: ?>
                                <a href="<?php echo U('AuOrder/platform_confirm_detail',['status'=>$params['status'],'order_id'=>$list['order_id']]);?>">确认</a><?php endif; ?>
                            <?php elseif($params["fenpei_auth"] AND $params['emp_id'] != $list['platform_confirm_service_id']): ?>
                            <a href="javascript:;" onclick="fenpei('<?php echo ($list["order_id"]); ?>');">分配</a><?php endif; endif; ?>
                    <?php elseif($list[status] >= 7 ): ?>
                    <a href="<?php echo U('AuOrder/platform_confirm_view',['status'=>$params['status'],'order_id'=>$list['order_id']]);?>"
                       target="_blank">查看</a><?php endif; ?>
            </td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
    </tbody>
</table>
<div class="error msg" style="color: red; text-align:left;"><?php echo ($errMsg); ?></div>
<div class="pageFaye"><div class="pager"><?php echo ($page); ?></div><div class="clear"></div></div>

<div class="deparHover" style="height: 200px;">
    <h4>分配客服</h4>
    <label>
        <select name="service_id" id="service_id" style="float: right;width: 360px;">
            <option value="0">请选择客服</option>
            <?php foreach($kfs as $kf):?>
            <option value="<?php echo ($kf["emp_id"]); ?>"><?php echo ($kf["real_name"]); ?></option>
            <?php endforeach;?>
        </select>
        分配给：
    </label>
    <div class="deparBtn">
        <input type="button" value="确定" class="deparQue" id="fenpeiQueding">
        <input type="button" value="取消" id="fenpeiQuxiao">
    </div>
</div>

<script type="text/javascript">
    function fenpei(order_id){
        var bg = $(".yunBei");
        var pp = $(".deparHover");
        var qd = $("#fenpeiQueding");
        var qx = $("#fenpeiQuxiao");

        $("#service_id").select2();
        bg.show();
        pp.show();
        $([bg,qd,qx]).each(function(i,n){
            $(n).unbind('click');
        });
        qx.click(hide_pp);
        bg.click(hide_pp);
        qd.click(function(){
            var service_id = $("#service_id").val();
            $.post("/AuOrder/platFormAssignServer",{"order_id":order_id, "service_id":service_id},function(data){
                if(data.code != 200){
                    shibai_alert(data.msg, 1500);
                    return false;
                }
                btn_alert("分配成功",1000,function(){
                    window.location.reload();
                });
            },"json");
        });
        function hide_pp(){
            bg.hide();
            pp.hide();
            bg.unbind('click');
        }
    }
</script>